package cn.bearspark.comment.provider.rpc;

import cn.bearspark.comment.dto.*;
import cn.bearspark.comment.provider.service.CommentService;
import cn.bearspark.comment.rpc.CommentRpc;
import cn.bearspark.common.dto.Page;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author f
 */
@Component
@DubboService
public class CommentRpcImpl implements CommentRpc {

    private final CommentService commentService;

    public CommentRpcImpl(CommentService commentService) {
        this.commentService = commentService;
    }

    @Override
    public void like(long commentId, int liked) {
        commentService.like(commentId, liked);
    }

    @Override
    public Page<BldgCommentDTO> pageQueryHappening(int pageNum, int pageSize, long happeningId, int order) {
        return commentService.pageQueryHappening(pageNum, pageSize, happeningId, order);
    }

    @Override
    public List<LayerCommentDTO> pageQueryLayer(int pageNum, int pageSize, long commentId) {
        return commentService.pageQueryLayer(pageNum, pageSize, commentId);
    }

    @Override
    public long commentHappening(HappeningReqDTO happeningReqDTO) {
        return commentService.commentHappening(happeningReqDTO);
    }

    @Override
    public ReplyRespDTO reply(ReplyReqDTO replyReqDTO) {
        return commentService.reply(replyReqDTO);
    }

    @Override
    public DeleteRespDTO delete(long userId, long commentId) {
        return commentService.delete(userId, commentId);
    }
}
